3.6.54 \(\int \frac {(a+b \cos (c+d x)) (A+B \cos (c+d x))}{\sqrt {\sec (c+d x)}} \, dx\) [554]

Optimal. Leaf size=148 \[ \frac {2 (5 a A+3 b B) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{5 d}+\frac {2 (A b+a B) \sqrt {\cos (c+d x)} F\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{3 d}+\frac {2 b B \sin (c+d x)}{5 d \sec ^{\frac {3}{2}}(c+d x)}+\frac {2 (A b+a B) \sin (c+d x)}{3 d \sqrt {\sec (c+d x)}} \]

[Out]

2/5*b*B*sin(d*x+c)/d/sec(d*x+c)^(3/2)+2/3*(A*b+B*a)*sin(d*x+c)/d/sec(d*x+c)^(1/2)+2/5*(5*A*a+3*B*b)*(cos(1/2*d
*x+1/2*c)^2)^(1/2)/cos(1/2*d*x+1/2*c)*EllipticE(sin(1/2*d*x+1/2*c),2^(1/2))*cos(d*x+c)^(1/2)*sec(d*x+c)^(1/2)/
d+2/3*(A*b+B*a)*(cos(1/2*d*x+1/2*c)^2)^(1/2)/cos(1/2*d*x+1/2*c)*EllipticF(sin(1/2*d*x+1/2*c),2^(1/2))*cos(d*x+
c)^(1/2)*sec(d*x+c)^(1/2)/d

________________________________________________________________________________________

Rubi [A]
time = 0.14, antiderivative size = 148, normalized size of antiderivative = 1.00, number of steps used = 8, number of rules used = 7, integrand size = 31, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.226, Rules used = {3039, 4081, 3872, 3854, 3856, 2720, 2719} \begin {gather*} \frac {2 (a B+A b) \sin (c+d x)}{3 d \sqrt {\sec (c+d x)}}+\frac {2 (a B+A b) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} F\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{3 d}+\frac {2 (5 a A+3 b B) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{5 d}+\frac {2 b B \sin (c+d x)}{5 d \sec ^{\frac {3}{2}}(c+d x)} \end {gather*}

Antiderivative was successfully verified.

[In]

Int[((a + b*Cos[c + d*x])*(A + B*Cos[c + d*x]))/Sqrt[Sec[c + d*x]],x]

[Out]

(2*(5*a*A + 3*b*B)*Sqrt[Cos[c + d*x]]*EllipticE[(c + d*x)/2, 2]*Sqrt[Sec[c + d*x]])/(5*d) + (2*(A*b + a*B)*Sqr
t[Cos[c + d*x]]*EllipticF[(c + d*x)/2, 2]*Sqrt[Sec[c + d*x]])/(3*d) + (2*b*B*Sin[c + d*x])/(5*d*Sec[c + d*x]^(
3/2)) + (2*(A*b + a*B)*Sin[c + d*x])/(3*d*Sqrt[Sec[c + d*x]])

Rule 2719

Int[Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticE[(1/2)*(c - Pi/2 + d*x), 2], x] /; FreeQ[{
c, d}, x]

Rule 2720

Int[1/Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticF[(1/2)*(c - Pi/2 + d*x), 2], x] /; FreeQ
[{c, d}, x]

Rule 3039

Int[(csc[(e_.) + (f_.)*(x_)]*(g_.))^(p_.)*((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.
) + (f_.)*(x_)])^(n_.), x_Symbol] :> Dist[g^(m + n), Int[(g*Csc[e + f*x])^(p - m - n)*(b + a*Csc[e + f*x])^m*(
d + c*Csc[e + f*x])^n, x], x] /; FreeQ[{a, b, c, d, e, f, g, p}, x] && NeQ[b*c - a*d, 0] &&  !IntegerQ[p] && I
ntegerQ[m] && IntegerQ[n]

Rule 3854

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[Cos[c + d*x]*((b*Csc[c + d*x])^(n + 1)/(b*d*n)), x
] + Dist[(n + 1)/(b^2*n), Int[(b*Csc[c + d*x])^(n + 2), x], x] /; FreeQ[{b, c, d}, x] && LtQ[n, -1] && Integer
Q[2*n]

Rule 3856

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Dist[(b*Csc[c + d*x])^n*Sin[c + d*x]^n, Int[1/Sin[c + d
*x]^n, x], x] /; FreeQ[{b, c, d}, x] && EqQ[n^2, 1/4]

Rule 3872

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_.)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_)), x_Symbol] :> Dist[a, Int[(d*
Csc[e + f*x])^n, x], x] + Dist[b/d, Int[(d*Csc[e + f*x])^(n + 1), x], x] /; FreeQ[{a, b, d, e, f, n}, x]

Rule 4081

Int[(csc[(e_.) + (f_.)*(x_)]*(d_.))^(n_)*(csc[(e_.) + (f_.)*(x_)]*(b_.) + (a_))*(csc[(e_.) + (f_.)*(x_)]*(B_.)
 + (A_)), x_Symbol] :> Simp[A*a*Cot[e + f*x]*((d*Csc[e + f*x])^n/(f*n)), x] + Dist[1/(d*n), Int[(d*Csc[e + f*x
])^(n + 1)*Simp[n*(B*a + A*b) + (B*b*n + A*a*(n + 1))*Csc[e + f*x], x], x], x] /; FreeQ[{a, b, d, e, f, A, B},
 x] && NeQ[A*b - a*B, 0] && LeQ[n, -1]

Rubi steps

\begin {align*} \int \frac {(a+b \cos (c+d x)) (A+B \cos (c+d x))}{\sqrt {\sec (c+d x)}} \, dx &=\int \frac {(b+a \sec (c+d x)) (B+A \sec (c+d x))}{\sec ^{\frac {5}{2}}(c+d x)} \, dx\\ &=\frac {2 b B \sin (c+d x)}{5 d \sec ^{\frac {3}{2}}(c+d x)}-\frac {2}{5} \int \frac {-\frac {5}{2} (A b+a B)-\frac {1}{2} (5 a A+3 b B) \sec (c+d x)}{\sec ^{\frac {3}{2}}(c+d x)} \, dx\\ &=\frac {2 b B \sin (c+d x)}{5 d \sec ^{\frac {3}{2}}(c+d x)}-(-A b-a B) \int \frac {1}{\sec ^{\frac {3}{2}}(c+d x)} \, dx-\frac {1}{5} (-5 a A-3 b B) \int \frac {1}{\sqrt {\sec (c+d x)}} \, dx\\ &=\frac {2 b B \sin (c+d x)}{5 d \sec ^{\frac {3}{2}}(c+d x)}+\frac {2 (A b+a B) \sin (c+d x)}{3 d \sqrt {\sec (c+d x)}}-\frac {1}{3} (-A b-a B) \int \sqrt {\sec (c+d x)} \, dx-\frac {1}{5} \left ((-5 a A-3 b B) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \sqrt {\cos (c+d x)} \, dx\\ &=\frac {2 (5 a A+3 b B) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{5 d}+\frac {2 b B \sin (c+d x)}{5 d \sec ^{\frac {3}{2}}(c+d x)}+\frac {2 (A b+a B) \sin (c+d x)}{3 d \sqrt {\sec (c+d x)}}-\frac {1}{3} \left ((-A b-a B) \sqrt {\cos (c+d x)} \sqrt {\sec (c+d x)}\right ) \int \frac {1}{\sqrt {\cos (c+d x)}} \, dx\\ &=\frac {2 (5 a A+3 b B) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{5 d}+\frac {2 (A b+a B) \sqrt {\cos (c+d x)} F\left (\left .\frac {1}{2} (c+d x)\right |2\right ) \sqrt {\sec (c+d x)}}{3 d}+\frac {2 b B \sin (c+d x)}{5 d \sec ^{\frac {3}{2}}(c+d x)}+\frac {2 (A b+a B) \sin (c+d x)}{3 d \sqrt {\sec (c+d x)}}\\ \end {align*}

________________________________________________________________________________________

Mathematica [A]
time = 0.61, size = 108, normalized size = 0.73 \begin {gather*} \frac {\sqrt {\sec (c+d x)} \left (6 (5 a A+3 b B) \sqrt {\cos (c+d x)} E\left (\left .\frac {1}{2} (c+d x)\right |2\right )+10 (A b+a B) \sqrt {\cos (c+d x)} F\left (\left .\frac {1}{2} (c+d x)\right |2\right )+(5 A b+5 a B+3 b B \cos (c+d x)) \sin (2 (c+d x))\right )}{15 d} \end {gather*}

Antiderivative was successfully verified.

[In]

Integrate[((a + b*Cos[c + d*x])*(A + B*Cos[c + d*x]))/Sqrt[Sec[c + d*x]],x]

[Out]

(Sqrt[Sec[c + d*x]]*(6*(5*a*A + 3*b*B)*Sqrt[Cos[c + d*x]]*EllipticE[(c + d*x)/2, 2] + 10*(A*b + a*B)*Sqrt[Cos[
c + d*x]]*EllipticF[(c + d*x)/2, 2] + (5*A*b + 5*a*B + 3*b*B*Cos[c + d*x])*Sin[2*(c + d*x)]))/(15*d)

________________________________________________________________________________________

Maple [B] Leaf count of result is larger than twice the leaf count of optimal. \(370\) vs. \(2(180)=360\).
time = 0.37, size = 371, normalized size = 2.51

method result size
default \(-\frac {2 \sqrt {\left (2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-1\right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}\, \left (-24 B \cos \left (\frac {d x}{2}+\frac {c}{2}\right ) \left (\sin ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) b +\left (20 A b +20 a B +24 B b \right ) \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \cos \left (\frac {d x}{2}+\frac {c}{2}\right )+\left (-10 A b -10 a B -6 B b \right ) \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right ) \cos \left (\frac {d x}{2}+\frac {c}{2}\right )+5 A \EllipticF \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-1}\, b -15 A \EllipticE \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-1}\, a +5 B \EllipticF \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-1}\, a -9 B \EllipticE \left (\cos \left (\frac {d x}{2}+\frac {c}{2}\right ), \sqrt {2}\right ) \sqrt {\frac {1}{2}-\frac {\cos \left (d x +c \right )}{2}}\, \sqrt {2 \left (\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-1}\, b \right )}{15 \sqrt {-2 \left (\sin ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\sin ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )}\, \sin \left (\frac {d x}{2}+\frac {c}{2}\right ) \sqrt {2 \left (\cos ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-1}\, d}\) \(371\)

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*cos(d*x+c))*(A+B*cos(d*x+c))/sec(d*x+c)^(1/2),x,method=_RETURNVERBOSE)

[Out]

-2/15*((2*cos(1/2*d*x+1/2*c)^2-1)*sin(1/2*d*x+1/2*c)^2)^(1/2)*(-24*B*cos(1/2*d*x+1/2*c)*sin(1/2*d*x+1/2*c)^6*b
+(20*A*b+20*B*a+24*B*b)*sin(1/2*d*x+1/2*c)^4*cos(1/2*d*x+1/2*c)+(-10*A*b-10*B*a-6*B*b)*sin(1/2*d*x+1/2*c)^2*co
s(1/2*d*x+1/2*c)+5*A*EllipticF(cos(1/2*d*x+1/2*c),2^(1/2))*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/2*d*x+1/2*c)^
2-1)^(1/2)*b-15*A*EllipticE(cos(1/2*d*x+1/2*c),2^(1/2))*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/2*d*x+1/2*c)^2-1
)^(1/2)*a+5*B*EllipticF(cos(1/2*d*x+1/2*c),2^(1/2))*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/2*d*x+1/2*c)^2-1)^(1
/2)*a-9*B*EllipticE(cos(1/2*d*x+1/2*c),2^(1/2))*(sin(1/2*d*x+1/2*c)^2)^(1/2)*(2*sin(1/2*d*x+1/2*c)^2-1)^(1/2)*
b)/(-2*sin(1/2*d*x+1/2*c)^4+sin(1/2*d*x+1/2*c)^2)^(1/2)/sin(1/2*d*x+1/2*c)/(2*cos(1/2*d*x+1/2*c)^2-1)^(1/2)/d

________________________________________________________________________________________

Maxima [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Failed to integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cos(d*x+c))*(A+B*cos(d*x+c))/sec(d*x+c)^(1/2),x, algorithm="maxima")

[Out]

integrate((B*cos(d*x + c) + A)*(b*cos(d*x + c) + a)/sqrt(sec(d*x + c)), x)

________________________________________________________________________________________

Fricas [C] Result contains higher order function than in optimal. Order 9 vs. order 4.
time = 0.12, size = 184, normalized size = 1.24 \begin {gather*} -\frac {5 \, \sqrt {2} {\left (i \, B a + i \, A b\right )} {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right ) + 5 \, \sqrt {2} {\left (-i \, B a - i \, A b\right )} {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right ) + 3 \, \sqrt {2} {\left (-5 i \, A a - 3 i \, B b\right )} {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right )\right ) + 3 \, \sqrt {2} {\left (5 i \, A a + 3 i \, B b\right )} {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right )\right ) - \frac {2 \, {\left (3 \, B b \cos \left (d x + c\right )^{2} + 5 \, {\left (B a + A b\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{\sqrt {\cos \left (d x + c\right )}}}{15 \, d} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cos(d*x+c))*(A+B*cos(d*x+c))/sec(d*x+c)^(1/2),x, algorithm="fricas")

[Out]

-1/15*(5*sqrt(2)*(I*B*a + I*A*b)*weierstrassPInverse(-4, 0, cos(d*x + c) + I*sin(d*x + c)) + 5*sqrt(2)*(-I*B*a
 - I*A*b)*weierstrassPInverse(-4, 0, cos(d*x + c) - I*sin(d*x + c)) + 3*sqrt(2)*(-5*I*A*a - 3*I*B*b)*weierstra
ssZeta(-4, 0, weierstrassPInverse(-4, 0, cos(d*x + c) + I*sin(d*x + c))) + 3*sqrt(2)*(5*I*A*a + 3*I*B*b)*weier
strassZeta(-4, 0, weierstrassPInverse(-4, 0, cos(d*x + c) - I*sin(d*x + c))) - 2*(3*B*b*cos(d*x + c)^2 + 5*(B*
a + A*b)*cos(d*x + c))*sin(d*x + c)/sqrt(cos(d*x + c)))/d

________________________________________________________________________________________

Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\left (A + B \cos {\left (c + d x \right )}\right ) \left (a + b \cos {\left (c + d x \right )}\right )}{\sqrt {\sec {\left (c + d x \right )}}}\, dx \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cos(d*x+c))*(A+B*cos(d*x+c))/sec(d*x+c)**(1/2),x)

[Out]

Integral((A + B*cos(c + d*x))*(a + b*cos(c + d*x))/sqrt(sec(c + d*x)), x)

________________________________________________________________________________________

Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*cos(d*x+c))*(A+B*cos(d*x+c))/sec(d*x+c)^(1/2),x, algorithm="giac")

[Out]

integrate((B*cos(d*x + c) + A)*(b*cos(d*x + c) + a)/sqrt(sec(d*x + c)), x)

________________________________________________________________________________________

Mupad [F]
time = 0.00, size = -1, normalized size = -0.01 \begin {gather*} \int \frac {\left (A+B\,\cos \left (c+d\,x\right )\right )\,\left (a+b\,\cos \left (c+d\,x\right )\right )}{\sqrt {\frac {1}{\cos \left (c+d\,x\right )}}} \,d x \end {gather*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(((A + B*cos(c + d*x))*(a + b*cos(c + d*x)))/(1/cos(c + d*x))^(1/2),x)

[Out]

int(((A + B*cos(c + d*x))*(a + b*cos(c + d*x)))/(1/cos(c + d*x))^(1/2), x)

________________________________________________________________________________________